﻿// ===============================================================================
// XCI.NET 西安交通信息WinForm开发框架 2018 版权所有
// ===============================================================================

using System.IO.Compression;

namespace XCI.Helper
{
    /// <summary>
    /// 文件和目录压缩帮助类
    /// </summary>
    public static class ZipHelper
    {
        /// <summary>
        /// 压缩目录
        /// </summary>
        /// <param name="zipPath">压缩文件路径</param>
        /// <param name="dirPath">待压缩目录路径</param>
        public static void CompressDirectory(string zipPath, string dirPath)
        {
            ZipFile.CreateFromDirectory(dirPath, zipPath);
        }

        /// <summary>
        /// 解压缩文件
        /// </summary>
        /// <param name="zipPath">压缩文件路径</param>
        /// <param name="dirPath">文件释放目录路径</param>
        public static void UnCompressDirectory(string zipPath, string dirPath)
        {
            ZipFile.ExtractToDirectory(zipPath, dirPath);
        }
    }
}